# import flet as ft
# from views import borrow, lend, query, settings
#
# def main_view(db, page):
#     nav_rail = ft.NavigationRail(
#         selected_index=0,
#         label_type=ft.NavigationRailLabelType.ALL,
#         destinations=[
#             ft.NavigationRailDestination(icon=ft.icons.INBOX, label="借出"),
#             ft.NavigationRailDestination(icon=ft.icons.OUTBOX, label="借入"),
#             ft.NavigationRailDestination(icon=ft.icons.SEARCH, label="查询"),
#             ft.NavigationRailDestination(icon=ft.icons.SETTINGS, label="设置"),
#         ],
#         on_change=lambda e: switch_page(e.control.selected_index),
#     )
#
#     content_area = ft.Column(
#         [borrow.get_view(db, page)],
#         alignment=ft.alignment.top_left,
#         expand=True
#     )
#
#     def switch_page(index):
#         print(f"Switch to page {index}")
#         views = [
#             inventory.get_view(db, page),
#             outbound.get_view(db, page),
#             query.get_view(db, page),
#             #settings.get_view(db, page)
#         ]
#         content_area.controls = [views[index]]
#         page.update()
#
#     return ft.Row(
#         [nav_rail, ft.VerticalDivider(width=1), content_area],
#         expand=True
#     )
